package com.huixiong;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <描述>
 *
 * @author timothy.yang cloudwise
 * @since 2021-10-27 14:22
 */
public class join_test {
    @Test
    public void join_test(){
        List<Param> ss = new ArrayList<>();
        ss.add(new Param("tind","boy"));
        ss.add(new Param("anny","girl"));
        ss.add(new Param("mary","girl"));
        System.out.println(ss.stream().map(param ->
             param.getGender()+":"+param.getName()
        ).collect(Collectors.joining(",")));

        List<Param> tind = ss.stream().filter(s -> s.getName().equals("tind"))
                .collect(Collectors.toList());
        tind.forEach(
                        s -> s.setName("qfwfqwfg")
                );
        System.out.println(tind);
    }

    @AllArgsConstructor
    @Data
    class Param{
        private String name;
        private String gender;

    }
}
